const express = require('express');
const router = express.Router();

router.get('/forCurrentUser', (req, res) => {
    const content = [];
    for(let i = 0; i < 40; i++) content.push({
        id: `${i}`,
        partOrderCode: `partOrderCode${i}`,
        partPIStatusHis: 15991006,
        code: `code${i}`,
        dealerCode: `dealerCode${i}`,
        country: `country${i}`,
        partSaleOrderHisStatus: 15991001,
        customerOrderCode: `customerOrderCode${i}`,
        orderTypeHis: 15951001,
        partOrderPriceTermsHis: 15981001,
        paymentHisType: 15971001,
        shipmentTypeHis: 15961001,
        totalQuantity: 747,
        totalAmount: 4554,
        currencyHis: 20011001,
        submitTime: '2019-08-28 18:34:59',
    });

    res.json({
        message: 'ok',
        payload: {
            content,
            totalElements: 40,
        }
    });
});

router.get('/:id', (req, res) => {
    res.json(
        {
            message: 'string',
            payload: {
                id: '1',
                dealerCode: 'dealerCode1',
                partOrderCode: 'partOrderCode1',
                submitTime: '2019-11-19T01:49:10.728Z',
                country: '中国',
                orderTypeHis: 15951001,
                paymentHisType: 15971001,
                customerOrderCode: 'customerOrderCode1',
                receivedPerson: 'receivedPerson1',
                partOrderPriceTermsHis: 15981001,
                receivedPersonPhone: '65465456',
                carier: 'carier1',
                receivedAddress: 'receivedAddress1',
                shipmentTypeHis: 15961001,
                receivedPort: 'receivedPort1',
                currencyHis: 20011001,
                shipmentPort: 'shipmentPort1',
                remark: 'remark1',
                details: [{
                    id: '1',
                    partCode: 'partCode1',
                    newPartCode: 'code1',
                    quantity: 1322,
                    price: 56146,
                    amount: 454646,
                }, {
                    id: '2',
                    partCode: 'partCode2',
                    newPartCode: 'code2',
                    quantity: 1322,
                    price: 56146,
                    amount: 454646,
                }],
                attachments: [{
                    id: '1',
                    filePath: 'partCode1',
                    fileName: '附件1',
                }, {
                    id: '2',
                    filePath: 'partCode2',
                    fileName: '附件2',
                }],
            }
        });
});

module.exports = router;
